package com.lgc.webtest.controller;

import com.lgc.webtest.configuration.AppConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/testConfig")
public class TestConfigController {

    @Value("${appconfig.config2}")
    private String config2;

    @RequestMapping("/getValue")
    public String getValue(){
        return config2;
    }

    @Autowired
    AppConfig appConfig;

//    @Autowired
//    AppConfig2 appConfig2;

    @RequestMapping("/testLog")
    public String testLog(){

        log.trace("testConfig日志输出 trace");
        log.debug("testConfig日志输出 debug");
        log.info("testConfig日志输出 info");
        log.warn("testConfig日志输出 warn");
        log.error("testConfig日志输出 error");

        return "testLog";
    }

    @RequestMapping("/testAppconfig")
    public String testAppconfig(){
        //String aaaaaa = appConfig2.getConfig2();

        int aa= appConfig.getConfig1();
        return appConfig.getConfig2();
    }
}
